package rayTracer;

import static rayTracer.ApplicationInterface.*;


public class Shader {
	public String name;
	public SHADER_TYPE shaderType;	
	public float[] color;
	public float[] diff;
	public float[] spec;
	public float[] refl;
	public float[] ambient;
	
	// Coeficientes de reflexion: Difusa, Especular, Ambiente
	public float kD = DIFFUSE_K;
	public float kS = SPECULAR_K;
	public float kA = AMBIENT_K;
	
	// Potencia de la luz especular
	public float specPower = SPECULAR_POWER;
	public int samples;

	// Coeficientes de reflexion y refraccion
	public float reflectK = REFLECT_K;
	public float refractK = REFRACT_K;
	public float refractIndex = REFRACT_INDEX;
	
	public Shader(){
		name = null;		
		shaderType = SHADER_TYPE.CONSTANT;
		color = new float[]{1,0,0,0};
		diff = new float[]{1,0,0,0};
		spec = new float[]{1,0,0,0};
		refl = new float[]{1,0,0,0};
		ambient = new float[]{1,1,1,1};
		specPower = 0;
		samples = 0;
	}
	
	public String toString(){
		StringBuffer str = new StringBuffer("");
		str.append("Shader name = "+name+"\n");
		str.append("Shader Type = "+shaderType+"\n");		
		str.append("Shader color = ( ");
		for( int i=0 ; i< color.length ; i++ )
			str.append(color[i]+" ");
		str.append(")\n");
		str.append("Shader diff = ( ");
		for( int i=0 ; i< diff.length ; i++ )
			str.append(diff[i]+" ");
		str.append(")\n");
		str.append("Shader spec = ( ");
		for( int i=0 ; i< spec.length ; i++ )
			str.append(spec[i]+" ");
		str.append(")\n");
		str.append("Shader Spec Power = "+specPower+"\n");
		str.append("Shader Samples = "+samples+"\n");
		return str.toString();
	}
}
